<style>
  /* 我们选定线性渐变的方向为 45deg，依次将渐变色值设为：transparent -> deeppink -> deeppink ->transparent。 */


  div {
    position: relative;
    margin: 50px auto;
    width: 100px;
    height: 100px;
    box-sizing: border-box;
    border: 1px solid #333;
    line-height: 120px;
    text-indent: 5px;
    background:
      linear-gradient(45deg, transparent 49.5%, deeppink 49.5%, deeppink 50.5%, transparent 50.5%);
  }
</style>

<div></div>